<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui">
<ui:composition template="../templates/layout.xhtml">
  <ui:define name="content">
   	<h:form prependId="false" id="growlForm">
			<p:growl id="growl" showDetail="false" />
	</h:form>
	<h:form prependId="false" id="dataForm">
			<p:panel id="data">
				<f:facet name="header">
					<h:outputText value="#{messages.label_observer}" />
				</f:facet>
				<h:outputFormat id="noRecordsFound"
					value="#{messages.label_no_records_found}"
					rendered="#{!voteSenderBean.dataVisible}">
					<f:param value="#{messages.label_observer}" />
				</h:outputFormat>
				<p:dataTable id="pemantauTable" paginator="true"
					value="#{voteSenderBean.voteSenders}" var="voteSender"
					resizableColumns="false"
					rendered="#{voteSenderBean.dataVisible}"
					paginatorTemplate=" {CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
					rowsPerPageTemplate="5,10,25,50" rows="10" widgetVar="pTable">
					<f:facet name="header">
						<p:outputPanel>
							<h:outputText value="Search Filter:"/>
							<h:inputText id="globalFilter" onkeyup="pTable.filter()"/>
						</p:outputPanel>
					</f:facet>
					<p:column filterBy="#{voteSender.name}" filterMatchMode="contains">
						<f:facet name="header">
							<h:outputText value="Nama" />
						</f:facet>
						<h:outputText value="#{voteSender.name}" />
					</p:column>
					<p:column filterBy="#{voteSender.cellularNumber}" filterMatchMode="contains">
						<f:facet name="header">
							<h:outputText value="Nomor Seluler" />
						</f:facet>
						<h:outputText value="#{voteSender.cellularNumber}" />
					</p:column>
					<p:column styleClass="action-column">
						<f:facet name="header">
							<h:outputText value="#{messages.label_actions}" />
						</f:facet>
						<p:commandButton id="editButton" icon="ui-icon-pencil"
							action="#{voteSenderBean.displayEdit}" ajax="false" async="false"
							title="#{messages.label_edit}">
							<f:setPropertyActionListener target="#{voteSenderBean.voteSender}"
								value="#{voteSender}" />
						</p:commandButton>
						<p:commandButton id="viewButton" icon="ui-icon-zoomin"
							update=":viewForm:viewPanelGrid" oncomplete="viewDialog.show()"
							title="#{messages.label_view}">
							<f:setPropertyActionListener target="#{voteSenderBean.voteSender}"
								value="#{voteSender}" />
						</p:commandButton>
						<p:commandButton id="deleteButton" icon="ui-icon-trash"
							oncomplete="deleteDialog.show()" title="#{messages.label_delete}">
							<f:setPropertyActionListener target="#{voteSenderBean.voteSender}"
								value="#{voteSender}" />
						</p:commandButton>
					</p:column>
				</p:dataTable>
			</p:panel>
		</h:form>
		<p:dialog id="viewDialog" header="#{messages.label_view} Pemantau"
			modal="true" widgetVar="viewDialog" dynamic="true" resizable="true"
			maximizable="true" showEffect="fade" hideEffect="fade">
			<p:outputPanel id="viewPanel">
				<h:form id="viewForm" enctype="multipart/form-data">
					<h:panelGrid id="viewPanelGrid" columns="2" styleClass="dialog"
						columnClasses="col1,col2">
						<h:outputLabel value="Name:" />
						<h:outputText value="#{voteSenderBean.voteSender.name}" />
						<h:outputLabel value="Cellular Number:" />
						<h:outputText value="#{voteSenderBean.voteSender.cellularNumber}" />
						<p:commandButton id="viewCloseButton"
							value="#{messages.label_close}" onclick="viewDialog.hide()"
							type="button" />
					</h:panelGrid>
				</h:form>
			</p:outputPanel>
		</p:dialog>
		<p:confirmDialog id="deleteDialog" widgetVar="deleteDialog"
			message="#{messages.label_delete_record}" showEffect="fade"
			hideEffect="explode" header="#{messages.label_confirm_deletion}"
			severity="alarm">
			<p:outputPanel id="deletePanel">
				<h:form id="deleteForm">
					<p:commandButton id="deleteYesButton" value="#{messages.label_yes}"
						action="#{voteSenderBean.delete}"
						update=":dataForm:data :growlForm:growl"
						oncomplete="deleteDialog.hide()" />
					<p:commandButton id="deleteNoButton" value="#{messages.label_no}"
						onclick="deleteDialog.hide()" type="button" />
				</h:form>
			</p:outputPanel>
		</p:confirmDialog>
  </ui:define>
</ui:composition>
</html>